/**
 * Styles for control elements in examples, not required for the examples' functionality
 */
:root {
    --main-fg: #101828;
    --main-bg: #fff;

    --chart-bg: #fff;
    --chart-border: #d0d5dd;

    --button-fg: #212529;
    --button-bg: transparent;
    --button-border: #d0d5dd;
    --button-hover-bg: rgba(0, 0, 0, 0.1);

    --input-accent: #0e4491;
    --input-focus-border: #3d7acd;
    --range-track-bg: #efefef;

    --row-gap: 6px;

    --select-chevron: url('data:image/svg+xml;utf8,<svg fill="none" stroke="%23667085" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24"><path d="M6 9L12 15L18 9"/></svg>');
    --checkbox-tick-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='3.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M20 6L9 17L4 12'/%3E%3C/svg%3E");

    --success: #0759c2;
    --error: #dc0505;
}

:root[data-color-scheme='dark'] {
    --main-fg: #fff;
    --main-bg: #141d2c;

    --chart-bg: #192232;
    --chart-border: #344054;

    --button-fg: #f8f9fa;
    --button-bg: transparent;
    --button-border: rgba(255, 255, 255, 0.2);
    --button-hover-bg: #2a343e;

    --input-accent: #a9c5ec;
    --input-focus-border: #3d7acd;
    --range-track-bg: #4a5465;

    --select-chevron: url('data:image/svg+xml;utf8,<svg fill="none" stroke="%239CA3AF" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24"><path d="M6 9L12 15L18 9"/></svg>');
    --checkbox-tick-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%232a343e' stroke-width='3.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M20 6L9 17L4 12'/%3E%3C/svg%3E");

    --success: #9bc7ff;
    --error: #ff7878;
}

*,
*::before,
*::after {
    box-sizing: border-box;
}

:root,
body {
    height: 100%;
    width: 100%;
    margin: 0;
    overflow: hidden;
}

/* Hide codesandbox highlighter */
body > #highlighter {
    display: none;
}

.example-controls {
    display: flex;
    flex-direction: column;
    flex-wrap: wrap;
}

.example-controls *,
.example-controls *::before,
.example-controls *::after {
    margin: 0 !important;
    font-family: -apple-system, 'system-ui', sans-serif;
    font-size: 14px;
    font-weight: 500;
    line-height: 17px;
    letter-spacing: 0.01em;
    color: var(--main-fg);
}

.example-controls :where(button, textarea, select, input[type='submit'], input[type='text'], input[type='number']) {
    appearance: none;
    display: inline-block;
    height: 36px;
    padding: 5px 14px 7px;
    white-space: nowrap;
    border-radius: 6px;
    color: var(--button-fg) !important;
    background-color: var(--button-bg);
    border: 1px solid var(--button-border);
    box-shadow: 0 0 0 0 transparent;
    transition:
        background-color 0.25s ease-in-out,
        border-color 0.25s ease-in-out,
        box-shadow 0.25s ease-in-out;
    align-self: flex-start;
}

.example-controls :where(button, select, input[type='submit']) {
    cursor: pointer;
}

.example-controls select {
    appearance: none;
    padding-right: 32px;
    padding-left: 14px;
    background: no-repeat center right 4px var(--select-chevron);
}

.example-controls textarea {
    height: auto;
    padding: 7px 14px;
}

.example-controls pre,
.example-controls code {
    font-family: SFMono-Regular, Menlo, Monaco, Consolas, 'Liberation Mono', 'Courier New', monospace;
}

.example-controls input {
    appearance: none;
}

.example-controls input[type='checkbox'],
.example-controls input[type='radio'] {
    border: 1px solid var(--button-border);
    cursor: pointer;
}

.example-controls input[type='radio'] {
    width: 20px;
    height: 20px;
    border-radius: 50%;
}

.example-controls input[type='radio']:checked {
    border-width: 0;
    box-shadow: inset 0 0 0 6px var(--input-accent);
}

.example-controls input[type='radio']:checked:focus-visible {
    box-shadow:
        inset 0 0 0 2px var(--input-focus-border),
        inset 0 0 0 3px var(--main-bg),
        inset 0 0 0 6px var(--input-accent);
}

.example-controls input[type='checkbox'] {
    width: 24px;
    height: 24px;
    border-radius: 6px;
    cursor: pointer;
}

.example-controls input[type='checkbox']:checked {
    background: var(--input-accent) no-repeat center/14px var(--checkbox-tick-icon);
    border-color: var(--input-accent);
}

.example-controls input[type='range'] {
    appearance: none;
    min-width: 160px;
    border-radius: 8px;
    cursor: pointer;
    overflow: hidden; /*  slider progress trick  */
    background: var(--range-track-bg);
}

.example-controls input[type='range']::-webkit-slider-runnable-track {
    appearance: none;
    height: 16px;
    background: var(--range-track-bg);
}

.example-controls input[type='range']::-moz-range-track {
    appearance: none;
    height: 16px;
    background: var(--range-track-bg);
}

.example-controls input[type='range']::-webkit-slider-thumb {
    appearance: none;
    height: 16px;
    width: 16px;
    background-color: var(--main-bg);
    border-radius: 50%;
    border: 2px solid var(--input-accent);
    box-shadow: -1007px 0 0 1000px var(--input-accent); /*  slider progress trick  */
}

.example-controls input[type='range']::-moz-range-thumb {
    appearance: none;
    height: 16px;
    width: 16px;
    background-color: var(--main-bg);
    border-radius: 50%;
    border: 2px solid var(--input-accent);
    box-shadow: -1007px 0 0 1000px var(--input-accent); /*  slider progress trick  */
}

.example-controls :is(button, input[type='submit'], select):hover {
    background-color: var(--button-hover-bg);
}

.example-controls :is(button:focus-visible, input:focus-visible, textarea:focus-visible, select:focus-visible) {
    border-color: var(--input-focus-border) !important;
    box-shadow:
        inset 0 0 0 1px var(--input-focus-border),
        inset 0 0 0 2px var(--main-bg);
    outline: none;
}

.controls-row {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: var(--row-gap);
    font-variant: tabular-nums;
}

.controls-row + .controls-row {
    margin-top: var(--row-gap);
}

.controls-row.center {
    justify-content: center;
}

.controls-row .push-right {
    margin-left: auto;
}

.controls-row .push-left {
    margin-right: auto;
}

.controls-row .gap-right {
    margin-right: calc(var(--row-gap) * 6);
}

.controls-row .gap-left {
    margin-left: calc(var(--row-gap) * 6);
}

/* Additional Styles */
#myGrid {
    flex: 1;
}

.example-wrapper {
    height: 100%;
    display: flex;
    flex-direction: column;
    gap: var(--row-gap);
}

.example-controls {
    display: flex;
    flex-direction: row;
    width: 100%;
    gap: calc(var(--row-gap) * 4);
}

.example-controls .request-container {
    flex: 1;
    display: flex;
    flex-direction: column;
}

.example-controls .response-container {
    flex: 1;
    display: flex;
    flex-direction: column;
}

.input-group {
    display: flex;
}

.input-group :not(:last-child) {
    border-right: 0;
}

.input-group :first-child {
    border-top-right-radius: 0 !important;
    border-bottom-right-radius: 0 !important;
}

.input-group :last-child {
    margin-left: -1px !important;
    border-top-left-radius: 0;
    border-bottom-left-radius: 0;
}

.input-group input {
    flex: 1;
}

.input-group input::placeholder {
    font-style: italic;
}

.request-container {
    display: flex;
    flex-direction: column;
    gap: var(--row-gap);
}

.request-container > div:last-of-type {
    margin-top: auto !important;
}

#processingStatus {
    min-height: 28px;
}

#processingStatus code {
    --fg: var(--main-fg);

    display: flex;
    padding: 5px 14px 4px;
    font-size: 12px;
    border-radius: 4px;
    background: color-mix(in srgb, var(--fg) 5%, transparent);
    color: var(--fg);
    border: 1px solid color-mix(in srgb, var(--fg) 15%, transparent);
}

#processingStatus code b {
    margin-left: auto !important;
    color: var(--fg);
    line-height: 1;
}

#processingStatus code.process b {
    transform-origin: 5.4px 7.2px;
    animation-name: spin;
    animation-duration: 2s;
    animation-timing-function: linear;
    animation-iteration-count: infinite;
}

@keyframes spin {
    from {
        transform: rotate(0deg);
    }
    to {
        transform: rotate(360deg);
    }
}

#processingStatus code.success {
    --fg: var(--success);
}

#processingStatus code.error {
    --fg: var(--error);
}

#processRequest {
    display: flex;
    align-items: center;
    justify-content: center;
}

.response-container {
    padding: 4px;
    border-radius: 6px;
    border: 1px dashed var(--chart-border);
}

.response-container {
    display: flex;
    flex-direction: column;
    gap: var(--row-gap);
}

#aiResponse i,
#aiResponse .msg {
    font-size: 12px;
}

#aiResponse i {
    display: block;
    color: color-mix(in srgb, var(--main-fg) 50%, transparent);
}

#aiResponse .msg {
    padding: 6px;
    border-radius: 4px;
    background: color-mix(in srgb, var(--main-fg) 3%, transparent);
    color: var(--main-fg);
    border: 1px solid color-mix(in srgb, var(--main-fg) 10%, transparent);
}

#aiResponse .prompt {
    margin-right: 32px !important;
}

#aiResponse .response {
    margin-left: 32px !important;
}

#aiResponse i.response {
    text-align: right;
}

#aiResponse .msg.prompt {
    margin-bottom: 12px !important;
}
